<nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <div class="navbar-header">
      <button class="navbar-toggle collapsed" type="button" data-toggle="collapse" data-target="#navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="/">
        <img style="max-width:50px; margin-top: -15px;" src=<%=image_path("favicon.png") %> >
        </img>
      </a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <% if logged_in? %>
      <ul class="nav navbar-nav navbar-right">

        <li id="monthtask">
          <a><i class="glyphicon glyphicon-th-list"></i> 本月事件  </a>        
        </li>

        <li >
          <%= link_to current_user do %>
          <i class="glyphicon glyphicon-th-list"></i> 今日事件
          <% end %>
        </li>

        <li>
          <%= link_to task_new_path do %>
          <i class="glyphicon glyphicon-plus"></i> 新建事件
          <% end %>
        </li>
        <li id="userid" style="display:none;">
          <%= current_user.id %>
        </li>

        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            <i class="glyphicon glyphicon-user"></i>
            <%= current_user.name + '(' + current_user.number + ')'%>
            <b class="caret"></b>
          </a>
          <ul class="dropdown-menu">
            <li>
              <%= link_to "修改密码", edit_user_path(current_user) %>
            </li>
            <li class="divider"></li>
            <li>
              <%= link_to "注销", logout_path, method: :delete %>
            </li>
          </ul>
        </li>
      </ul>


      <% else %>
      <ul class="nav navbar-nav navbar-right">
        <li class="active">
          <%= link_to "Log in", login_path %>
        </li>
      </ul>
      <% end %>
    </div>
  </div>
</nav>